<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<f:view>
	<h:head></h:head>
	<h:body>
		<h:form id="form">
		<p:growl id="growl" showDetail="true" sticky="true" /> 
			<h:panelGrid columns="3">
				<h:outputText value="Sipariş Tarihi" />
				<p:calendar id="ilkTarihi"
					value="#{siparisSorguManageBean.ilkTarih}" pattern="dd/MM/yyyy"></p:calendar>

				<p:calendar id="sonTarihi" pattern="dd/MM/yyyy"
					value="#{siparisSorguManageBean.sonTarih}"></p:calendar>

				<h:outputText value="Sipariş No" />
				<h:inputText value="#{siparisSorguManageBean.ilkSiparisKodu}">
				</h:inputText>
				<h:inputText value="#{siparisSorguManageBean.sonSiparisKodu}">
				</h:inputText>
				<p:commandButton value="göster"
					actionListener="#{siparisSorguManageBean.kayitListele}"
					update="dataTable" />

				<p:commandButton value="yeni kayıt" action="siparis.xhtml"
					ajax="false" />

				<p:commandButton value="Raporla"
					actionListener="#{siparisSorguManageBean.raporAl}"
					update="dataTable,growl" />
			</h:panelGrid>

			<p:dataTable id="dataTable" var="siparis"
				value="#{siparisSorguManageBean.siparisBeans}">
				<f:facet name="header">
				</f:facet>
				<p:column id="modelHeader" sortBy="#{siparis.siparisKodu}">
					<f:facet name="header">
						<h:outputText value="Siparis No" />
					</f:facet>
					<h:outputText value="#{siparis.siparisKodu}" />
				</p:column>

				<p:column sortBy="#{siparis.durum}">
					<f:facet name="header">
						<h:outputText value="Durum" />
					</f:facet>
					<h:outputText value="#{siparis.durum}" />
				</p:column>

				<p:column sortBy="#{siparis.siparisTarihi}">
					<f:facet name="header">
						<h:outputText value="Sipariş Tarihi" />
					</f:facet>
					<h:outputText value="#{siparis.siparisTarihi}" />
				</p:column>

				<p:column>
					<f:facet name="header">
						<h:outputText value="" />
					</f:facet>
					<p:commandButton value="DETAY" oncomplete="siparisDialog.show();"
						actionListener="#{siparisSorguManageBean.siparisDetayGoster}"
						update="form:dialog">
						<f:param name="siparisId" value="#{siparis.id}"></f:param>
					</p:commandButton>
				</p:column>
			</p:dataTable>

			<p:dialog id="dialog" header="Sipariş Detayı"
				widgetVar="siparisDialog" resizable="false" showEffect="explode"
				hideEffect="explode">
				<p:dataTable id="detayTableId" var="detay"
					value="#{siparisSorguManageBean.detayBeans}">
					<p:column id="modelHeader">
						<f:facet name="header">
							<h:outputText value="Malzeme Adı" />
						</f:facet>
						<h:outputText value="#{detay.malzemeId.malzemeAdi}" />
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="Açıklama " />
						</f:facet>
						<h:outputText value="#{detay.siparisDetayAciklama}" />
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="Adet" />
						</f:facet>
						<h:outputText value="#{detay.miktar}" />
					</p:column>


				</p:dataTable>
			</p:dialog>
		</h:form>
	</h:body>
</f:view>
</html>